package com.dq.Week1.day03;

import java.util.Scanner;

public class loop {
    public static class Demo01 {
        public static void main(String[] args) {
            int sum = 0;
            for(int i=1;i<=100;i++)
            {
                sum += i;
                if(sum>888)
                {
                    System.out.println(i);
                    break;
                }
            }
        }
    }

    public static class Demo02 {
        public static void main(String[] args) {
            for(int i=1;i<100;i++)
            {
                if(i%3==0)
                {
                    continue;
                }
                System.out.println(i);
            }
        }
    }

    public static class Demo03 {
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            while (true)
            {
                System.out.println("请输入信息");
                String s = scanner.next();

                if(s.equals("886"))
                {
                    System.out.println("服务器说："+s);
                    break;
                }else{
                    System.out.println("服务器说:"+s);
                }


            }


        }
    }

    public static class Demo04 {
        public static void main(String[] args) {

            Scanner sc = new Scanner(System.in);
            String s = sc.next();
            boolean wc = s.contains("wc");

            String s1 = s.replace("sb","***");
            System.out.println(s1);
            System.out.println(s);

            String s2 = s.replaceAll("wc","***");
            System.out.println(s2);

            String s3 = s.replaceAll("wc","***");
        }
    }

    public static class Demo05 {
        public static void main(String[] args) {
            int lineNum = 3;
            int colNum = 3;

            printStar(lineNum,colNum);


        }
        public  static void printStar(int lineNum,int colNum)
        {
            for(int i=0;i<5;i++)
            {
                // System.out.println("*****");
                for (int j = 0; j < 5; j++) {
                    System.out.print("*");
                }
                System.out.println();
            }
        }

    }

    public static class Demo06 {
        public static void main(String[] args) {
            extracted();
        }

        private static void extracted() {
            for(int i=0;i<5;i++)
            {
                for(int j=0;j<i+1;j++)
                {
                    System.out.print("*");
                }
                System.out.println();
            }
        }
    }

    public static class Demo07 {
        public static void main(String[] args) {
            int lineNum = 5;
            for (int i=0;i<lineNum;i++)
            {
                for (int j = 0; j < lineNum-1-i; j++) {
                    {
                        System.out.print(" ");
                    }
                    for (int k = 0; k < lineNum; k++) {
                        {
                            System.out.print("*");
                        }
                    }
                    System.out.println();
                }
            }
        }
    }

    public static class Demo08 {
        public static void main(String[] args) {
            int lineNum=9;
            for (int i = 0; i <= 9; i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    System.out.print(i+"*"+j+"="+(i*j+"\t"));
                }
                System.out.println("");
            }
        }
    }

    public static class Demo09 {
        public static void main(String[] args) {
            int x;
            int y;
            for (int i = 0; i <= 35; i++) {
                for (int j = 0; j <=35 ; j++) {
                    if(i+j==35 && 2*i+4*j==94)
                    {
                        System.out.println("鸡的数量为："+i);
                        System.out.println("兔的数量为："+j);

                    }            }
            }
        }
    }

    public static class Demo11 {
        public static void main(String[] args) {
            long sum = 0;
            for(int i=1;i<=10;i++)
            {
                long multy=1;
                for (int j = 0; j <i ; j++) {
                    multy = multy*10;
                }
                long a = multy-1;
                sum = sum+a;
            }
            System.out.println(sum);
        }
    }

    public static class lessionPricticeDemo {
        //waterGoldFlowerNumber
        public static void main(String[] args) {
            waterGoldFlowerNumber();
            calculateSum();
            Marks();
        }
        public static void waterGoldFlowerNumber()
        {
            //水仙花数 num
            //a = num/100
            //b = num/10%10
            //c = num%10
            //a*a*a+b*b*b+c*c*c = num
            for (int i = 100; i <=999 ; i++) {
                int a = i/100;
                int b = i/10%10;
                int c = i%10;

                if(a*a*a+b*b*b+c*c*c == i)
                {
                    System.out.println(i);
                }
            }
        }

        public  static  void  calculateSum()
        {
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入要求求和的数字：");
            int num = scanner.nextInt();
            int a = num/100;
            int b = num/10%10;
            int c = num%10;
            System.out.println("各个位数之和为："+(a+b+c));
        }
        public  static  void Marks()
        {

            //man+woman+child == 30
            //3*man+2*woman+child == 50
            for (int i = 0; i <=50; i++) {
                for (int j = 0; j <=25; j++) {
                    for (int k = 0; k < 18; k++) {
                        if(i+j*2+k*3==50){
                            // 三种人的个数需要等于30
                            if(i+j+k==30){
                                System.out.println("人数可能分别是: " + "男人"  +  k  + "女人"+ j + "小孩" + i + "\n或");
                            }
                        }



                    }
                }

            }
        }
    }

    public static class sumDemo {
        public static void main(String[] args) {
            int sum = 0;
            int num = 0;
            int min = 0;
            int max = 0;
            Scanner scanner = new Scanner(System.in);
            for(int i=0;i<5;i++)
            {
                int score = scanner.nextInt();
                if(i==0)
                {
                    max = score;
                    min = score;
                }
                sum +=score;
                if(max<score)
                {
                    max = score;
                }
                if(min>score)
                {
                    min = score;
                }
                num++;
            }
            System.out.println("平均成绩为："+sum/num);
            System.out.println("最大值："+max);
            System.out.println("最小值："+min);
        }
    }
}
